package itanty.aop05;

import com.itanty.exception.UserExistException;
import com.itanty.exception.UserNotExistException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @date 2025/9/24
 */
public class Test {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("aop05.xml");
        UserService userService = (UserService) ac.getBean("userService");
        SomeService someService = (SomeService) ac.getBean("someService");
        OtherService otherService = (OtherService) ac.getBean("otherService");
        try {
            userService.register("admin", "123456", "13812345678", "江苏-南京");
        } catch (UserExistException e) {
        }
        System.out.println("******************************************");
        try {
            userService.login("admin", "123456");
        } catch (UserNotExistException e) {
        }
        System.out.println("******************************************");
        userService.doSome();
        System.out.println("******************************************");
        userService.doOther();
        System.out.println("******************************************");
        someService.doSome();
        System.out.println("******************************************");
        someService.doSome("admin");
        System.out.println("******************************************");
        someService.doSome("s1", "s2");
        System.out.println("******************************************");
        someService.doOther();
        System.out.println("******************************************");
        someService.add(1, 2);
        System.out.println("******************************************");
        otherService.doSome();
        System.out.println("******************************************");
        otherService.doSome("other");
        System.out.println("******************************************");
        otherService.doOther();
        System.out.println("******************************************");
        otherService.add(1, 2);
    }
}
